package com.example.hospitalsystem.controller;

import com.example.hospitalsystem.result.Result;
import com.example.hospitalsystem.service.CollectService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/collect")
@Tag(name="15.收藏模块")
public class CollectController {
    @Autowired
    private CollectService collectService;

    @Operation(summary = "用户收藏",security = {@SecurityRequirement(name = "Authorization")})
    @GetMapping("/collectDesign/{designId}")
    public Result collectDesign(@PathVariable("designId") int designId){
        return collectService.collectDesign(designId);
    }

    @Operation(summary = "用户取消收藏",security = {@SecurityRequirement(name = "Authorization")})
    @GetMapping("/cancleCollectDesign/{designId}")
    public Result cancleCollectDesign(@PathVariable("designId") int designId){
        return collectService.cancleCollectDesign(designId);
    }

    @Operation(summary = "用户查看所有收藏",security = {@SecurityRequirement(name = "Authorization")})
    @GetMapping("/lookAllcollect")
    public Result lookAllCollect(){
        return collectService.lookAllCollect();
    }

    @Operation(summary = "判断是否已经收藏过",security = {@SecurityRequirement(name = "Authorization")})
    @GetMapping("/getCollectState/{designId}")
    public Result getCollectStateFun(@PathVariable("designId") Integer designId){
        return collectService.getStateCollect(designId);
    }

}
